package com.tbvtc.agriculturalcreditchainserver2025.controller.admin;

import com.tbvtc.agriculturalcreditchainserver2025.entity.Addess.Area;
import com.tbvtc.agriculturalcreditchainserver2025.service.AddressService;
import com.tbvtc.agriculturalcreditchainserver2025.utils.RUtils;
import com.tbvtc.agriculturalcreditchainserver2025.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("/admin")
@Tag(name ="地址")
public class AddressController {

    /**
     * 查询省市区
     */
    @Autowired
    private AddressService addressService;
    @Operation(summary = "查询省市区")
    @GetMapping("/checkProvincesMunicipalities")
    @Parameter(name = "pid", description = "父级id(初始为0)")
    public Result checkProvincesMunicipalities( Long pid){
        List<Area> areas = addressService.checkProvincesMunicipalities(pid);
        return RUtils.success(areas);
    }


}
